import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import mainRouter from './main'
import store from  '../store'

Vue.use(Router)

const router= new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    ...mainRouter
  ]
})

router.beforeEach((to, from, next)=>{
  store.commit("addHistory", to);
  next();
})

router.afterEach(route =>{

})

export default router
